package com.td.teach.activity;

import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.td.teach.R;

public class Page5Activity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_05);
    }

    public void voice_i(View v){

        final SoundPool sp = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
        final int music = sp.load(this, R.raw.i, 1);
        sp.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
            @Override
            public void onLoadComplete(SoundPool arg0, int arg1, int arg2) {
                sp.play(music, 1, 1, 0, 0, 1);
            }
        });
    }

    public void voice_u(View v){

        final SoundPool sp = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
        final int music = sp.load(this, R.raw.u, 1);
        sp.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
            @Override
            public void onLoadComplete(SoundPool arg0, int arg1, int arg2) {
                sp.play(music, 1, 1, 0, 0, 1);
            }
        });
    }


    public void voice_v(View v){

        final SoundPool sp = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
        final int music = sp.load(this, R.raw.v, 1);
        sp.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
            @Override
            public void onLoadComplete(SoundPool arg0, int arg1, int arg2) {
                sp.play(music, 1, 1, 0, 0, 1);
            }
        });
    }

}
